import { createRouter, createWebHistory } from "vue-router";
import Login from "@/views/Login/index.vue";
import Layout from "@/views/Layout/index.vue";
import Home from "@/views/Home/index.vue";
import Category from "@/views/Category/index.vue";
//创建路由实例
const router = createRouter({
  //路由工作模式
  history: createWebHistory(import.meta.env.BASE_URL),
  //配置路径与组件的对应关系
  routes: [
    {
      path: "/",
      name: "home",
      component: Layout,
      //添加二级路由
      children: [
        //默认二级路由将配置项置空
        { path: "", component: Home },
        //二级路由
        { path: "category", component: Category },
      ],
    },
    {
      path: "/login",
      name: "login",
      component: Login,
    },
    // {
    //   path: '/about',
    //   name: 'about',
    //   component: () => import('../views/AboutView.vue'),
    // },
  ],
});

export default router;
